package Network;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

import BasicClient.Constants;
import DataStructures.Card;
import DataStructures.PokerPlayer;

public class RemotePokerPlayer extends PokerPlayer{

	//private Socket playerSocket;
	private int playerId;
	private DataOutputStream out;
	
	public RemotePokerPlayer(Socket playerSocket, int playerID, DealerMonitor dealer){
		super();
		//this.playerSocket = playerSocket;
		try {
			out = new DataOutputStream(playerSocket.getOutputStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
		this.setPlayerID(playerID);
		// dont forget to initialize the player id, it is essential this id is totally random. 
		// people can hack the server if id's are easy to guess or brute force. 
		// this is a problem public key cryptography can solve easily, not in protocol version one though.
		
		IncomingRequestHandlerThread requestHandler = new IncomingRequestHandlerThread(playerSocket, dealer);
		requestHandler.start();
	}
	
	public int getPlayerId(){
		return playerId;
	}
	
	public void setPlayerID(int playerID){
		System.out.println("Sending ID to player! " + playerID);
		try {
			out.writeByte(Constants.ServerToPlayerConstants.ASSIGN_PLAYER_ID_HEADER);
			out.writeInt(Constants.PlayerBroadcastConstants.SPECIAL_PLAYER_ID);		
			out.writeInt(playerID);
		} catch (IOException e) {
			e.printStackTrace();
		}		
	}
	
	public void prompt(){
		
	}
	
	public void dealHoleCards(Card[] cards){
		
	}
	
	public void awardChips(int amount){
		
	}
	
	public void announceRaise(int seatNumber, int amount){
		
	}
	
	public void announceFlop(Card[] cards){
		
	}
	
	public void announceTurn(Card card){
		
	}
	
	public void announceRiver(Card card){
		
	}
	
	public void announceCurrentBlinds(int bigBlind, int smallBlind){
		
	}
	
	public void announcePlayersCards(Card[] cards){
		
	}
	
	class IncomingRequestHandlerThread extends Thread{
		
		private Socket sock;
		private DealerMonitor dealer;
		
		public IncomingRequestHandlerThread(Socket sock, DealerMonitor dealer){
			this.sock = sock;
			this.dealer = dealer;
		}
		
		public void run(){
			
		}
		
	}
	
}
